package com.example.demoweb.entity;

import com.example.demoweb.config.GenderDeserializer;
import com.example.demoweb.config.LocalDateTimeDeserializer;
import com.example.demoweb.config.MyLocalDateTimeSerializer;
import com.example.demoweb.config.TimeTypeDeserializer;
import com.example.demoweb.enums.Gender;
import com.example.demoweb.enums.TimeType;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;
import java.util.Date;

/**
 * @author 赵恒
 * @date 2023/5/22
 */
@Data
public class Person {
    private Integer id;

    private String name;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date birthday;

    @JsonDeserialize(using = TimeTypeDeserializer.class)
    private TimeType timeType;

    @JsonDeserialize(using = GenderDeserializer.class)
    private Gender gender;

    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = MyLocalDateTimeSerializer.class)
    private LocalDateTime updateTime;
}
